package com.tools.common.object.json.deserializer;

import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

public abstract class CustomTypeDeserializer<T> extends StdDeserializer<T> {

    private final Class<T> targetType;

    public Class<T> getTargetType() {
        return targetType;
    }

    protected CustomTypeDeserializer(Class<T> vc) {
        super(vc);
        this.targetType = vc;
    }

    protected CustomTypeDeserializer(JavaType valueType) {
        super(valueType);
        this.targetType = (Class<T>) valueType.getRawClass();
    }

    protected CustomTypeDeserializer(StdDeserializer<T> src) {
        super(src);
        this.targetType = (Class<T>) src.getValueType().getRawClass();
    }
}
